Skip to content

Clarify conftest hook timing before collection#14563

Closed
CortexShadow wants to merge 1 commit into
pytest-dev:mainfrom
CortexShadow:fix-report-header-conftest-docs-14557
Closed

Clarify conftest hook timing before collection#14563
CortexShadow wants to merge 1 commit into
pytest-dev:mainfrom
CortexShadow:fix-report-header-conftest-docs-14557

Conversation

@CortexShadow

@CortexShadow CortexShadow commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Clarify that only initial conftest files are available for hooks which run before collection, such as pytest_sessionstart and pytest_report_header.

This addresses the confusing case where a deeper conftest can still receive later/historic hooks like pytest_configure, but cannot affect the terminal header once pytest_report_header has already run.

Closes #14557.

@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jun 6, 2026
@bluetech

bluetech commented Jun 8, 2026

Copy link
Copy Markdown
Member

Thanks, but we already have a note to this effect a bit below ("Some hooks cannot be implemented in conftest.py files [...]").

@bluetech bluetech closed this Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pytest_report_header from conftest.py not collected, in contradiction with documented behavior

2 participants